<%@ page import="java.time.LocalDateTime" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" isErrorPage="true"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/jquery-1.9.1.min.js"></script>
</head>
<body>
<%=LocalDateTime.now()%><br/>
<a href="${pageContext.request.contextPath}/getAllAjax">ajax获取所有员工</a><br/>
<div>

</div>
<script type="text/javascript">
    $("a:first").click(function () {
        //1.发送ajax获取所有员工
        $.ajax({
            url:"${pageContext.request.contextPath}/getAllAjax",
            type:"POST",
            success:function (data) {
                // console.log(data);
                $("div").empty();
                $.each(data,function () {
                    var employee = this.lastName + "-->" + this.birth + "--->" + this.gender;
                   $("div").append(employee + "<br/>");
                });
            }
        });
        return false;
    });
</script>
</body>
</html>
